/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package centralehotel.modele;

import centralehotel.exception.*;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mathieu
 */
@Entity
@Table(name = "agence")
@NamedQueries({@NamedQuery(name = "Agence.findByIdAgence", query = "SELECT a FROM Agence a WHERE a.idAgence = :idAgence"), @NamedQuery(name = "Agence.findByNom", query = "SELECT a FROM Agence a WHERE a.nom = :nom"), @NamedQuery(name = "Agence.findByLogin", query = "SELECT a FROM Agence a WHERE a.login = :login"), @NamedQuery(name = "Agence.findByPassword", query = "SELECT a FROM Agence a WHERE a.password = :password")})
public class Agence implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "id_agence", nullable = false)
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Integer idAgence;
    @Column(name = "nom")
    private String nom;
    @Column(name = "login")
    private String login;
    @Column(name = "password")
    private String password;
    @OneToMany(mappedBy = "agence")
    private Collection<Reservation> reservationCollection;

    public Agence() {
    }

    public Agence(Integer idAgence) {
        this.idAgence = idAgence;
    }

    public Integer getIdAgence() {
        return idAgence;
    }

    public void setIdAgence(Integer idAgence) {
        this.idAgence = idAgence;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Collection<Reservation> getReservationCollection() {
        return reservationCollection;
    }

    public void setReservationCollection(Collection<Reservation> reservationCollection) {
        this.reservationCollection = reservationCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAgence != null ? idAgence.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Agence)) {
            return false;
        }
        Agence other = (Agence) object;
        if ((this.idAgence == null && other.idAgence != null) || (this.idAgence != null && !this.idAgence.equals(other.idAgence))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "centralehotel.exception.Agence[idAgence=" + idAgence + "]";
    }

}
